home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1993, 1994 Marc Parmet.
- * This file is part of the Macintosh port of GNU Emacs.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #if defined(THINK_C)
-
- void
- bzero(char *b,int n)
- {
- asm {
- move.l b,a0
- move.l n,d0
- bra.s @test
-
- top1: swap.w d0
- top2: clr.b (a0)+
- test: dbf.w d0,@top2
- swap.w d0
- dbf.w d0,@top1
- }
- }
-
- void
- bcopy(char *b1,char *b2,int n)
- {
- asm {
- move.l b1,a0
- move.l b2,a1
- move.l n,d0
- bra.s @test
-
- top1: swap.w d0
- top2: move.b (a0)+,(a1)+
- test: dbf.w d0,@top2
- swap.w d0
- dbf.w d0,@top1
- }
- }
-
- int
- bcmp(char *b1,char *b2,int n)
- {
- asm {
- move.l b1,a0
- move.l b2,a1
- move.l n,d0
- move.w #4,ccr ; set Z bit
- bra.s @test
-
- top1: swap.w d0
- top2: cmpm.b (a0)+,(a1)+
- test: dbne.w d0,@top2
- bne.s @nomatch
- swap.w d0
- dbf.w d0,@top1
- moveq.l #0,d0
- return
- nomatch:moveq.l #1,d0
- }
- }
-
- #else
-
- void
- bzero(char *b,int n)
- {
- while (n--)
- *b++ = 0;
- }
-
- void
- bcopy(char *b1,char *b2,int n)
- {
- while (n--)
- *b2++ = *b1++;
- }
-
- int
- bcmp(char *b1,char *b2,int n)
- {
- while (n--)
- if (*b1++ != *b2++)
- return 1;
-
- return 0;
- }
-
- #endif
-